#ifndef CELL_H
#define CELL_H

#include <BioEntity.h>

#include "kdtree/kdtree.h"

class Cell : public BioEntity
{
    public:
        Cell(const Ogre::String &name,
				  OgreBulletDynamics::DynamicsWorld *world,
				  kdtree* kdFood,
				  const short collisionGroup = 0,
				  const short collisionMask = 0);
        virtual ~Cell();

        void stepBioSimulation(Real elapsedTime);

        virtual void collideWith(BioEntity* other);

        struct kdtree* kdFood;


        class CellAction {
        protected:
        	Cell* cell;
        public:
        	CellAction(Cell* cell) : cell(cell) {}
        	virtual CellAction* stepBioSimulation(Real elapsedTime) = 0;
        };

        class Idle : public CellAction {

        public:
        	Idle(Cell* cell) : CellAction(cell) {}
        	virtual CellAction* stepBioSimulation(Real elapsedTime);
        };

        class SearchFood : public CellAction {
        public:
        	SearchFood(Cell* cell) : CellAction(cell) {}
        	virtual CellAction* stepBioSimulation(Real elapsedTime);
        };

        class GoEatFood : public CellAction {

        public:
        	Ogre::Vector3 foodPos;

        	GoEatFood(Cell* cell) : CellAction(cell) {}
        	virtual CellAction* stepBioSimulation(Real elapsedTime);
        };

        CellAction* action;

        Idle* idle;
        SearchFood* searchFood;
        GoEatFood* goEatFood;

    protected:

    private:
};

#endif // CELL_H
